﻿using System;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MichMan.Utilities;
using MichMan.Utilities.Requests;
using System.Collections.Generic;

namespace Subsonic.ViewModels
{
    public class SettingsViewModel : PivotViewModel
    {
        public SettingsViewModel(string firstPivotId)
        {
            Id = firstPivotId;
        }

        public override IRequest LoadPivots()
        {
            List<PivotItemViewModel> pivots = new List<PivotItemViewModel>();
            PivotItemViewModel serversGroup = new PivotItemViewModel() { Title = "{settings_servers_title}", Id = "{settings_servers_title}" };
            serversGroup.Items.Add(new Serveritem(0));
            serversGroup.Items.Add(new Serveritem(1));
            serversGroup.Items.Add(new Serveritem(2));
            pivots.Add(serversGroup);
            PivotItemViewModel networkGroup = new PivotItemViewModel() { Title = "{settings_network_title}", Id = "{settings_network_title}" };
            networkGroup.Items.Add(new MobileBitRateItem());
            networkGroup.Items.Add(new WiFiBitRateItem());
            pivots.Add(networkGroup);
            PivotItemViewModel musicCacheGroup = new PivotItemViewModel() { Title = "{settings_cache_title}", Id = "{settings_cache_title}" };
            musicCacheGroup.Items.Add(new SongsToPreLoadItem());
            musicCacheGroup.Items.Add(new CacheSizeItem());
            pivots.Add(musicCacheGroup);

            if (Id != null)
            {
                pivots = pivots.Pivot(p => p.Id == this.Id).ToList();
            }

            pivots.ForEach(p => this.Pivots.Add(p));

            return null;
        }
    }
}
